<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        /* body{
            text-shadow:;
        } */
    </style>
</head>

<body>
    <script>
        //粘贴事件获取剪切板的数据
        // document.addEventListener("paste", function () {
        //     if (event.clipboardData || event.originalEvent) {
        //         var clipboardData = (event.clipboardData || window.clipboardData);
        //         var val = clipboardData.getData('text');
        //         console.log(val);
        //         event.preventDefault();
        //     }
        // });
        //js自动获取剪切板中的第一位数据
        navigator.clipboard.readText().then(v=>{
            console.log('获取成功',v);
        }).catch(e=>{
            console.log('获取失败',e);
        })
    </script>
</body>

</html>